/* Wasson An
 * This class represents a set of coordinates
 */

package catandmouse;

public class Coordinate {

	private int x; //the x coordinate
	private int y; //the y coordinate
	
	
	//2 parameter constructor
	public Coordinate(int x, int y){
		
		this.x = x;
		this.y = y;
	}//int int constructor
	
	
	//returns x coordinate
	public int getX(){
		
		return x;
	}//getX
	
	
	//returns the y coordinate
	public int getY(){
		
		return y;
	}//getY
	
	
	//sets the x coordinate
	public void setX(int x){
		
		this.x = x;
	}//setX
	
	
	//sets the y coordinate
	public void setY(int y){
		
		this.y = y;
	}//setY
	
	
	//returns the distance between two coordinates
	public static double distance(Coordinate a, Coordinate b){
		
		return Math.abs(Math.sqrt(Math.pow(a.x - b.x, 2) +
				Math.pow(a.y - b.y, 2)));
	}//distance
	
	
	//returns if two coordinates are equal
	public boolean equals(Object o){
		
		if(o == this)
			return true;
		if(!(o instanceof Coordinate))
			return false;
		
		Coordinate t = (Coordinate)o;
		
		return this.x == t.x && this.y == t.y;
	}//equals
}//Coordinate
